﻿CREATE TABLE [dbo].[People_Victim] (
    [GenderID]       INT NULL,
    [AgeRangeID]     INT NULL,
    [VictimStatusID] INT NULL,
    [Id]             INT NOT NULL IDENTITY,
    CONSTRAINT [PK_People_Victim] PRIMARY KEY CLUSTERED ([Id] ASC),
    CONSTRAINT [FK_VictimStatusVictim] FOREIGN KEY ([VictimStatusID]) REFERENCES [dbo].[Lookups] ([LookupID]),
    CONSTRAINT [FK_AgeRangeVictim] FOREIGN KEY ([AgeRangeID]) REFERENCES [dbo].[Lookups] ([LookupID]),
    CONSTRAINT [FK_GenderVictim] FOREIGN KEY ([GenderID]) REFERENCES [dbo].[Lookups] ([LookupID]),
    CONSTRAINT [FK_Victim_inherits_Person] FOREIGN KEY ([Id]) REFERENCES [dbo].[People] ([Id]) ON DELETE CASCADE
);


GO
CREATE NONCLUSTERED INDEX [IX_FK_VictimStatusVictim]
    ON [dbo].[People_Victim]([VictimStatusID] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_FK_AgeRangeVictim]
    ON [dbo].[People_Victim]([AgeRangeID] ASC);


GO
CREATE NONCLUSTERED INDEX [IX_FK_GenderVictim]
    ON [dbo].[People_Victim]([GenderID] ASC);

